Setting the Table Border in HTML 5

When you create a table, it is without a border and it looks incomplete. You can add a border to a table by using the border attribute of the <table> tag. Apart from adding a border to a table, you can also set the thickness of the border. By default, the value of the table border is either 0 or no value is set.

Let’s do the following steps to set the border of the table:


<!DOCTYPE html>
<head>
    <title>Table Border</title>
</head>
<body bgcolor=”alicablue”>
<table border=”1”>
<caption>
    <h2>Table Border</h2>
</caption
<tr>
    <th>Name</th>
    <th>Date of Birth</th>
    <th>Address</th>
</tr>
    <tr>
        <td>Manish Kumar</td>
        <td> 15-03-1983</td>
        <td>Flat No, 303, Shipra Suncity, Ghaziabad</td>
    </tr>
    <tr>
        <td>Rajesh Gupta </td>
        <td>22-02-1984</td>
        <td> H. No.-32, Rajendra Place, New Delhi</td>
    </tr>
    <tr>
        <td>Manisha Dubey </td>
        <td>05-02-1995</td>
        <td> H. No.-125, Patel Nagar, New Delhi</td>
    </tr>
</table>
</body>
</html> 

Save the document with the name TableBorder.html. Open the document on browser:

add table border in html %